package com.wsc.wisdomchinaqinghe.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.wsc.wisdomchinaqinghe.R;

import java.util.List;

/**
 * 百姓监督详情页面图片适配器
 * Created by ${wangtao} on 2017/3/10.
 */

public class PeopleControlDetailAdapter extends BaseAdapter {
    private Context context;
    private List<String> image_list;

    public PeopleControlDetailAdapter(Context context, List<String> image_list) {
        this.context = context;
        this.image_list = image_list;
    }

    @Override
    public int getCount() {
        return image_list.size();
    }

    @Override
    public Object getItem(int position) {
        return image_list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder = null;
        View view = convertView;
        if (view == null) {
            view = LayoutInflater.from(context).inflate(R.layout.peoplecontroldetail_item, null);
            holder = new ViewHolder(view);
            view.setTag(holder);
        } else {
            holder = (ViewHolder) view.getTag();
        }
        Glide.with(context).load(image_list.get(position)).into(holder.item_bxjdxq_image_image);
        return view;
    }

    protected class ViewHolder {
        private ImageView item_bxjdxq_image_image;

        public ViewHolder(View view) {
            item_bxjdxq_image_image = (ImageView) view.findViewById(R.id.item_bxjdxq_image_image);
        }
    }
}
